﻿using UnityEngine;
using System.Collections;
 
public class AnimatedUVs : MonoBehaviour 
{
    public int materialIndex = 0;
    public Vector2 uvAnimationRate = new Vector2( 1.0f, 0.0f );
    public string textureName = "_MainTex";
 	
	float scrollspeed = 0.5f;
    Vector2 uvOffset = Vector2.zero;
 
    void LateUpdate() 
    {
        //uvOffset += ( uvAnimationRate * Time.deltaTime );
		float offset = Time.time * scrollspeed;	
        renderer.material.SetTextureOffset( textureName, new Vector2(offset,0));
    }
}